<div class="main-content">
	<header>
		<h2>Exhibitions</h2>
	</header>

	<section>
    <?php echo $this->renderPartial('/partials/_notifications'); ?>
		<table class="exhibition datatable paginate sortable full">
			<thead>
			<tr>
				<th>Institution Name</th>
				<th>Email</th>
				<th>Status</th>
				<th>Created At</th>
				<th>Modified At</th>
				<th style="width:70px"></th>
			</tr>
			</thead>
			<tbody>
			<?php foreach ($exhibitions as $exhibition){ ?>
			<tr <?php if($exhibition->status == Exhibitions::STATUS_PENDING){ echo "class='pending'"; }else{ echo "class='finished'"; } ?> >
				<td align="center" style="word-wrap:break-word;"><a href="<?php echo bu('admin/exhibitions/'.$exhibition->id); ?>"><?php echo $exhibition->institution_name; ?></a></td>
				<td align="center" style="word-wrap:break-word;"><?php echo $exhibition->email; ?></td>
				<td align="center" style="word-wrap:break-word;"><?php echo Exhibitions::model()->getStatusName($exhibition->status); ?></td>
				<td align="center" style="word-wrap:break-word;"><?php echo Helpers::customDate($exhibition->created_at); ?></td>
				<td align="center" style="word-wrap:break-word;"><?php echo Helpers::customDate($exhibition->modified_at); ?></td>
				<td>
				<ul class="action-buttons">
          <?php if($exhibition->status == Exhibitions::STATUS_PENDING){ ?>
            <li><a href="<?php echo bu('admin/exhibitions/accept'); ?>?id=<?php echo $exhibition->id; ?>" method="POST" class="button button-gray no-text"><span class="accept"></span>Finished</a></li>
          <?php }else{?>
            <li><a href="<?php echo bu('admin/exhibitions/decline'); ?>?id=<?php echo $exhibition->id; ?>" method="POST" class="button button-gray no-text"><span class="decline"></span>Decline</a></li>
          <?php } ?>
            <li><a href="<?php echo bu('admin/exhibitions/delete'); ?>?id=<?php echo $exhibition->id; ?>" method="POST" class="button button-gray no-text"><span class="bin"></span>Delete</a></li>
				</ul>
				</td>
			</tr>
			<?php } ?>
			</tbody>
		</table>

    <div class="pagination">
      <?php
        $this->widget('CLinkPager',array(
          'pages'=>$pages,
          "cssFile" => false,
          "header" => "",
        ));
      ?>
    </div>
	</section>
</div>